<?
/**
 * Copyright 2007 Melange.
 *
 * This file is part of PHP-MELANGE.
 *
 * PHP-MELANGE is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * PHP-MELANGE is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PHP-MELANGE; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @category    Melange
 * @package     php-melange
 * @subpackage  cms
 * @copyright   Copyright (c) 2007 Jeroen Simons. All rights reserved
 * @author      Jeroen Simons <jeroen@melange.nl>
 * @link        http://www.melange.nl/
 *
 */

require_once("cms/core/helper/Abstract.php");

class PHP_CMS_View_Helper_End extends PHP_CMS_View_Helper_Abstract {

    public function end($listForm, $to, $rows) {

        if($rows == 0) {

            ob_end_clean();

            $xhtml .= "<div id=\"errorMsg\">";
            $xhtml .= "<h3>".$this->message("list.outputbuffer.header", _Core::BUNDLE)."</h3>";
            $xhtml .= "<ol>";
            if(!is_null($to)) {
                $xhtml .= "<li><a href=\"".$to."\">".$this->message("list.outputbuffer.new", _Core::BUNDLE).".</a></li>";
            }
            $xhtml .= "<li><a href=\"javascript:query('".get_class($listForm)."')\">".$this->message("list.outputbuffer.adjust", _Core::BUNDLE).".</a></li>";
            $xhtml .= "<li><a href=\"javascript:clean('".get_class($listForm)."')\">".$this->message("list.outputbuffer.clear", _Core::BUNDLE).".</a></li>";
            $xhtml .= "</ol>";
            $xhtml .= "</div>";

            echo $xhtml;

        } else {
            ob_get_flush();
        }
    }

}
?>